package yf.mall.enums.app;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * 时间分类枚举
 * @author yxmds
 */
public enum AppTimeTypeEnum {

    MIN_30(1, "30分钟"),
    HOUR_1(2, "1小时"),

    HOUR_2(3, "2小时"),
    ;

    int type;

    String value;

    AppTimeTypeEnum(int type, String value) {
        this.type = type;
        this.value = value;
    }

    public int getType() {
        return type;
    }

    public String getValue() {
        return value;
    }

    public static final AppTimeTypeEnum getByKey(Integer type) {
        return Stream.of(AppTimeTypeEnum.values()).filter(typeEnum -> Objects.equals(type, typeEnum.type)).findFirst().orElse(null);
    }
}
